home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / KEYBOARD.SWG / 0063_Scan Keys.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  3KB  |  88 lines

  1. unit ScanCode;
  2.  
  3. { This UNIT is created by Wayne Boyd, aka Vipramukhya Swami, BBS phone
  4.    (604)431-6260, Fidonet node 1:153/763. It's function is to facilitate
  5.    the use of Function keys and Alt keys in a program. It includes F1
  6.    through F10, Shift-F1 through Shift-F10, Ctrl-F1 through Ctrl-F10,
  7.    and Alt-F1 through Alt-F10. It also includes all of the alt keys, all
  8.    of the Ctrl keys and many other keys as well. This UNIT and source code
  9.    are copyrighted material and may not be used for commercial use
  10.    without express written permission from the author. Use at your own
  11.    risk. I take absolutely no responsibility for it, and there are no
  12.    guarantees that it will do anything more than take up space on your
  13.    disk. }
  14.  
  15.  
  16. interface
  17.  
  18. CONST
  19.  
  20.   F1  = 59;   CtrlF1  =  94;   AltF1  = 104;   Homekey   = 71;
  21.   F2  = 60;   CtrlF2  =  95;   AltF2  = 105;   Endkey    = 79;
  22.   F3  = 61;   CtrlF3  =  96;   AltF3  = 106;   PgUp      = 73;
  23.   F4  = 62;   CtrlF4  =  97;   AltF4  = 107;   PgDn      = 81;
  24.   F5  = 63;   CtrlF5  =  98;   AltF5  = 108;   UpArrow   = 72;
  25.   F6  = 64;   CtrlF6  =  99;   AltF6  = 109;   RtArrow   = 77;
  26.   F7  = 65;   CtrlF7  = 100;   AltF7  = 110;   DnArrow   = 80;
  27.   F8  = 66;   CtrlF8  = 101;   AltF8  = 111;   LfArrow   = 75;
  28.   F9  = 67;   CtrlF9  = 102;   AltF9  = 112;   InsertKey = 82;
  29.   F10 = 68;   CtrlF10 = 103;   AltF10 = 113;   DeleteKey = 83;
  30.  
  31.   AltQ = 16;   AltA = 30;   AltZ = 44;   Alt1 = 120;  ShftF1 = 84;
  32.   AltW = 17;   AltS = 31;   AltX = 45;   Alt2 = 121;  ShftF2 = 85;
  33.   AltE = 18;   AltD = 32;   AltC = 46;   Alt3 = 122;  ShftF3 = 86;
  34.   AltR = 19;   AltF = 33;   AltV = 47;   Alt4 = 123;  ShftF4 = 87;
  35.   AltT = 20;   AltG = 34;   AltB = 48;   Alt5 = 124;  ShftF5 = 88;
  36.   AltY = 21;   AltH = 35;   AltN = 49;   Alt6 = 125;  ShftF6 = 89;
  37.   AltU = 22;   AltJ = 36;   AltM = 50;   Alt7 = 126;  ShftF7 = 90;
  38.   AltI = 23;   AltK = 37;                Alt8 = 127;  ShftF8 = 91;
  39.   AltO = 24;   AltL = 38;                Alt9 = 128;  ShftF9 = 92;
  40.   AltP = 25;   CtrlLf = 115;             Alt0 = 129;  ShftF10= 93;
  41.                CtrlRt = 116;
  42.  
  43.   CtrlA  = #1;  CtrlK = #11; CtrlU = #21; CtrlB = #2;  CtrlL = #12;
  44.   CtrlV  = #22; CtrlC = #3;  CtrlM = #13; CtrlW = #23; CtrlD = #4;
  45.   CtrlN  = #14; CtrlX = #24; CtrlE = #5;  CtrlO = #15; CtrlY = #25;
  46.   CtrlF  = #6;  CtrlP = #16; CtrlZ = #26; CtrlG = #7;  CtrlQ = #17;
  47.   CtrlS  = #19; CtrlH = #8;  CtrlR = #18; CtrlI = #9;  CtrlJ = #10;
  48.   CtrlT = #20;  BSpace = #8; EscapeKey = #27; EnterKey = #13; NullKey = #0;
  49.  
  50. implementation
  51.  
  52. end.
  53.  
  54. Program Sample;
  55.  
  56. uses
  57.   scancode,
  58.   crt;
  59.  
  60. procedure GetKey;
  61. var
  62.   ch : char;
  63. begin
  64.   repeat
  65.     ch := upcase(readkey);  { check key }
  66.     if ch = NullKey then    { NullKey = #0 }
  67.     begin
  68.       case ord(readkey) of  { check key again }
  69.         F1   : Dothis;        { put your procedures here }
  70.         F2   : DoThat;
  71.         altx : AltXPressed;
  72.       end; {case}
  73.     end
  74.     else
  75.     case ch of
  76.       CtrlY     : CtrlYPressed;   { put your procedures here }
  77.       CtrlT     : CtrlTPressed;
  78.       BSpace    : BackSpacePressed;
  79.       EnterKey  : EnterKeyPressed;
  80.       EscapeKey : quitprogram;
  81.     end;
  82.   until ch = EscapeKey;
  83. end;
  84.  
  85. begin
  86.   GetKey;
  87. end.
  88.